package com.zhou.piledriver.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhou.piledriver.common.PageRequest;
import com.zhou.piledriver.common.R;
import com.zhou.piledriver.common.ResponseResult;
import com.zhou.piledriver.model.entity.PdDeviceRecord;
import com.zhou.piledriver.model.entity.PdWarning;
import com.zhou.piledriver.model.so.RecordSo;
import com.zhou.piledriver.model.so.SimpleSo;
import com.zhou.piledriver.service.PdPileService;
import com.zhou.piledriver.service.PdWarningService;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ZhouShenBin
 * @date 2024/3/27 10:12
 * @description
 */
@RestController
@RequestMapping("/warning")
public class PdWarningController {
    @Resource
    private PdWarningService pdWarningService;
    @PostMapping("/list")
    public ResponseResult list(@RequestBody PageRequest<RecordSo> so) {

        return R.success(pdWarningService.list(new Page<>(so.getCurrent(), so.getSize()), so.getQuery()));
    }

    @PostMapping("/rule")
    public ResponseResult rule(@RequestBody PageRequest<SimpleSo> so) {
        System.out.println(so.getCurrent());
        System.out.println(so.getSize());
        return R.success(pdWarningService.rule(new Page<>(so.getCurrent(), so.getSize()), so.getQuery()));
    }
}
